From da0fdbe113e9b3a5254822a20a8ca2595cd661cb Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 14 Jan 2022 18:21:10 +0000 Subject: syntax --- src/Entities/Player.cpp | 2 +- src/LightingThread.cpp | 2 +- src/Mobs/Chicken.cpp | 2 +- src/Mobs/Monster.cpp | 4 ++-- src/Mobs/Mooshroom.cpp | 2 +- src/Mobs/Pig.cpp | 2 +- src/Mobs/Sheep.cpp | 2 +- src/OSSupport/IsThread.cpp | 2 +- src/Protocol/Protocol_1_8.cpp | 4 ++-- src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 0ec8b9c5a..de4acc806 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -2344,7 +2344,7 @@ void cPlayer::SendBlocksAround(int a_BlockX, int a_BlockY, int a_BlockZ, int a_R { for (int x = a_BlockX - a_Range + 1; x < a_BlockX + a_Range; x++) { - blks.emplace_back(x, y, z, E_BLOCK_AIR, NIBBLETYPE(0)); // Use fake blocktype, it will get set later on. + blks.emplace_back(x, y, z, E_BLOCK_AIR, static_cast(0)); // Use fake blocktype, it will get set later on. } } } // for y diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp index aabd574a8..f4aa1d69e 100644 --- a/src/LightingThread.cpp +++ b/src/LightingThread.cpp @@ -359,7 +359,7 @@ void cLightingThread::PrepareSkyLight(void) // Fill the top of the chunk with all-light: if (m_MaxHeight < cChunkDef::Height - 1) { - std::fill(m_SkyLight + (m_MaxHeight + 1) * BlocksPerYLayer, m_SkyLight + ARRAYCOUNT(m_SkyLight), NIBBLETYPE(15)); + std::fill(m_SkyLight + (m_MaxHeight + 1) * BlocksPerYLayer, m_SkyLight + ARRAYCOUNT(m_SkyLight), static_cast(15)); } // Walk every column that has all XZ neighbors diff --git a/src/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp index bb0a4efbf..cc9609450 100644 --- a/src/Mobs/Chicken.cpp +++ b/src/Mobs/Chicken.cpp @@ -40,7 +40,7 @@ void cChicken::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { cItems Drops; m_EggDropTimer = 0; - Drops.emplace_back(E_ITEM_EGG, char(1)); + Drops.emplace_back(E_ITEM_EGG, static_cast(1)); m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); } else diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index c6f786eac..e05264f9f 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -1511,7 +1511,7 @@ void cMonster::RightClickFeed(cPlayer & a_Player) void cMonster::AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth) { auto Count = GetRandomProvider().RandInt(a_Min, a_Max); - char MaxStackSize = cItem(a_Item).GetMaxStackSize(); + auto MaxStackSize = static_cast(cItem(a_Item).GetMaxStackSize()); while (Count > MaxStackSize) { a_Drops.emplace_back(a_Item, MaxStackSize, a_ItemHealth); @@ -1531,7 +1531,7 @@ void cMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short { if (GetRandomProvider().RandBool(a_Chance / 100.0)) { - a_Drops.emplace_back(a_Item, char(1), a_ItemHealth); + a_Drops.emplace_back(a_Item, static_cast(1), a_ItemHealth); } } diff --git a/src/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp index 3e4cb7154..35eb7f3d1 100644 --- a/src/Mobs/Mooshroom.cpp +++ b/src/Mobs/Mooshroom.cpp @@ -65,7 +65,7 @@ void cMooshroom::OnRightClicked(cPlayer & a_Player) } cItems Drops; - Drops.emplace_back(E_BLOCK_RED_MUSHROOM, char(5), char(0)); + Drops.emplace_back(E_BLOCK_RED_MUSHROOM, static_cast(5), static_cast(0)); m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); m_World->SpawnMob(GetPosX(), GetPosY(), GetPosZ(), mtCow, false); Destroy(); diff --git a/src/Mobs/Pig.cpp b/src/Mobs/Pig.cpp index dc26caca9..5e7c18bf8 100644 --- a/src/Mobs/Pig.cpp +++ b/src/Mobs/Pig.cpp @@ -34,7 +34,7 @@ void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer) AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP); if (m_bIsSaddled) { - a_Drops.emplace_back(E_ITEM_SADDLE, char(1)); + a_Drops.emplace_back(E_ITEM_SADDLE, static_cast(1)); } } diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp index 14d8dd8d8..be4def2b7 100644 --- a/src/Mobs/Sheep.cpp +++ b/src/Mobs/Sheep.cpp @@ -42,7 +42,7 @@ void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer) if (!m_IsSheared) { - a_Drops.emplace_back(E_BLOCK_WOOL, char(1), static_cast(m_WoolColor)); + a_Drops.emplace_back(E_BLOCK_WOOL, static_cast(1), static_cast(m_WoolColor)); } unsigned int LootingLevel = 0; diff --git a/src/OSSupport/IsThread.cpp b/src/OSSupport/IsThread.cpp index 41f6b81bc..03ca2bfc4 100644 --- a/src/OSSupport/IsThread.cpp +++ b/src/OSSupport/IsThread.cpp @@ -114,7 +114,7 @@ void cIsThread::SetThreadName() const #pragma pack(pop) const DWORD NAME_EXCEPTION = 0x406D1388; - const THREADNAME_INFO Name = { 0x1000, m_ThreadName.c_str(), DWORD(-1), 0 }; + const THREADNAME_INFO Name = { 0x1000, m_ThreadName.c_str(), static_cast(-1), 0 }; __try { diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index 71f5b16fe..1308f1826 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -513,7 +513,7 @@ void cProtocol_1_8_0::SendEntityAnimation(const cEntity & a_Entity, const Entity return; } - if (const auto AnimationID = GetProtocolEntityAnimation(a_Animation); AnimationID != unsigned char(-1)) + if (const auto AnimationID = GetProtocolEntityAnimation(a_Animation); AnimationID != static_cast(-1)) { cPacketizer Pkt(*this, pktEntityAnimation); Pkt.WriteVarInt32(a_Entity.GetUniqueID()); @@ -1978,7 +1978,7 @@ unsigned char cProtocol_1_8_0::GetProtocolEntityAnimation(const EntityAnimation case EntityAnimation::PlayerLeavesBed: return 2; case EntityAnimation::PlayerMainHandSwings: return 0; case EntityAnimation::PlayerOffHandSwings: return 0; - default: return unsigned char(-1); + default: return static_cast(-1); } } diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h index 9e4b8ead1..8f5e8c1b7 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h @@ -23,7 +23,7 @@ namespace RedstoneRepeaterHandler if (!Chunk.UnboundedRelGetBlock(a_Position, Type, Meta)) { - return std::make_pair(false, NIBBLETYPE(0)); + return std::make_pair(false, static_cast(0)); } return std::make_pair(IsOn(Type), Meta); -- cgit v1.2.3